Object[] options = {"初级", "中级", "高级"};

int choice = JOptionPane.showOptionDialog(null, "请选择难度:", "难度选择",
                JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);

switch (choice) {
    case 0: return Difficulty.BEGINNER;
    case 1: return Difficulty.INTERMEDIATE;
    case 2: return Difficulty.EXPERT;
    default: return Difficulty.BEGINNER; // 默认值
}
